package com.gegao.calc;

import com.gegao.calc.operator.Operator;

import java.util.Scanner;

/**
 * Created by zhangzhanzhong on 2015/12/23.
 */
public class Main {
    public static void main(String[] args) {
        while (true) {
            System.out.println("please input: num1");
            Scanner in = new Scanner(System.in);
            int num1 = in.nextInt();

            System.out.println("please input operatorStr");
            String operatorStr = in.next();

            System.out.println("please input num2");
            int num2 = in.nextInt();

            Operator operator = null;
            try {
                operator = OperatorFactory.getOperator(operatorStr);
                System.out.println("result:" + operator.getResult(num1, num2));
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
}
